/**
 * 
 */
package IOStreamDemo;

import java.io.CharArrayReader;
import java.io.CharArrayWriter;
import java.io.Reader;
import java.io.Writer;

/**
 * @作者 Administrator
 * @创建日期2015-4-17
 * @版本
 */
public class CharArrayAccess {
	public static void main(String[] args) throws Exception {
		String tmp = "abcdefghijklmnopqrstuvwxyz";
		char[] src = tmp.toCharArray();                      //把字符串转换成字符数组
		//创建关于字符数组的读取流对象input
		CharArrayReader input = new CharArrayReader(src);
		//创建输出流对象output对象
		CharArrayWriter output = new CharArrayWriter();
		new CharArrayAccess().transform(input, output);
		String result = output.toString();                     //获取输出流中的字符串
		System.out.println(new String(result));
	}
	public void transform(Reader in, Writer out) {
		int c = 0;
		try {
			while ((c = in.read()) != -1)
			{
				int C = (int) Character.toUpperCase((char) c);
				out.write(C);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
